Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If result of evaluated javascript is a number return it as Dimension. #1769

Merged
merged 1 commit into from
Dec 31, 2013

Conversation

lesswtf
Copy link
Contributor

@lesswtf lesswtf commented Dec 30, 2013

Fix for issue #1768

Use-case:

@outerWidthPx: 100px;
@borderWidthPx: 1px;

.element {
  width: @outerWidthPx - @borderWidthPx * 2;
  border: @borderWidthPx solid #000;

  &.small {
    // Half of @borderWidthPx, but not smaller than 1px
    @halfBorderWidth: unit(~`Math.max(1, Math.floor(parseInt("@{borderWidthPx}") / 2))`, px);

    border-width: @halfBorderWidth;
    width: floor(@outerWidthPx / 2) - @halfBorderWidth * 2;
  }
}

lukeapage added a commit that referenced this pull request Dec 31, 2013
If result of evaluated javascript is a number return it as Dimension.
@lukeapage lukeapage merged commit c1b70ba into less:master Dec 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants